🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / data / src / commonMain / kotlin / org / meshtastic / core / data / manager / FromRadioPacketHandlerImpl.kt
Displaying Raw • Download
core/data/src/commonMain/kotlin/org/meshtastic/core/data/manager/FromRadioPacketHandlerImpl.kt cdeb1ac532b587f5db718504b5d6093ab55a859c (cdeb1ac5) Text, 7.30 KB
T8b949e/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.data.manager
Tff7b72import T7ee787co.touchlab.kermit.Logger
Tff7b72import T7ee787kotlinx.coroutines.CoroutineScope
Tff7b72import T7ee787kotlinx.coroutines.SupervisorJob
Tff7b72import T7ee787org.koin.core.annotation.Single
Tff7b72import T7ee787org.meshtastic.core.common.util.handledLaunch
Tff7b72import T7ee787org.meshtastic.core.common.util.ioDispatcher
Tff7b72import T7ee787org.meshtastic.core.repository.FromRadioPacketHandler
Tff7b72import T7ee787org.meshtastic.core.repository.MeshRouter
Tff7b72import T7ee787org.meshtastic.core.repository.MqttManager
Tff7b72import T7ee787org.meshtastic.core.repository.Notification
Tff7b72import T7ee787org.meshtastic.core.repository.NotificationManager
Tff7b72import T7ee787org.meshtastic.core.repository.PacketHandler
Tff7b72import T7ee787org.meshtastic.core.repository.ServiceRepository
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.client_notification
Tff7b72import T7ee787org.meshtastic.core.resources.duplicated_public_key_title
Tff7b72import T7ee787org.meshtastic.core.resources.getStringSuspend
Tff7b72import T7ee787org.meshtastic.core.resources.key_verification_final_title
Tff7b72import T7ee787org.meshtastic.core.resources.key_verification_request_title
Tff7b72import T7ee787org.meshtastic.core.resources.key_verification_title
Tff7b72import T7ee787org.meshtastic.core.resources.low_entropy_key_title
Tff7b72import T7ee787org.meshtastic.proto.ClientNotification
Tff7b72import T7ee787org.meshtastic.proto.FromRadio
T8b949e/** Implementation of [FromRadioPacketHandler] that dispatches [FromRadio] variants to specialized handlers. */
Tf0883e@Single
Tff7b72class T56d364FromRadioPacketHandlerImplTb4b4b4(
Tff7b72private Tff7b72val Te6edf3serviceRepositoryTb4b4b4: Te6edf3ServiceRepositoryTb4b4b4,
Tff7b72private Tff7b72val Te6edf3routerTb4b4b4: Te6edf3LazyTff7b72<Te6edf3MeshRouterTff7b72>Tb4b4b4,
Tff7b72private Tff7b72val Te6edf3mqttManagerTb4b4b4: Te6edf3MqttManagerTb4b4b4,
Tff7b72private Tff7b72val Te6edf3packetHandlerTb4b4b4: Te6edf3PacketHandlerTb4b4b4,
Tff7b72private Tff7b72val Te6edf3notificationManagerTb4b4b4: Te6edf3NotificationManagerTb4b4b4,
Tb4b4b4) Tb4b4b4: Te6edf3FromRadioPacketHandler Tb4b4b4{
T8b949e// Application-scoped coroutine context for suspend work (e.g. getStringSuspend).
T8b949e// This @Single lives for the entire app lifetime, so the SupervisorJob is never cancelled.
Tff7b72private Tff7b72val Te6edf3scope Tff7b72= Te6edf3CoroutineScopeTb4b4b4(Te6edf3ioDispatcher Tff7b72+ Te6edf3SupervisorJobTb4b4b4(Tb4b4b4)Tb4b4b4)
Tf0883e@SuppressTb4b4b4(Ta5d6ff"Ta5d6ffCyclomaticComplexMethodTa5d6ff"Tb4b4b4)
Tff7b72override Tff7b72fun Td2a8ffhandleFromRadioTb4b4b4(Te6edf3protoTb4b4b4: Te6edf3FromRadioTb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3myInfo Tff7b72= Te6edf3protoTb4b4b4.Te6edf3my_info
Tff7b72val Te6edf3metadata Tff7b72= Te6edf3protoTb4b4b4.Te6edf3metadata
Tff7b72val Te6edf3nodeInfo Tff7b72= Te6edf3protoTb4b4b4.Te6edf3node_info
Tff7b72val Te6edf3configCompleteId Tff7b72= Te6edf3protoTb4b4b4.Te6edf3config_complete_id
Tff7b72val Te6edf3mqttProxyMessage Tff7b72= Te6edf3protoTb4b4b4.Te6edf3mqttClientProxyMessage
Tff7b72val Te6edf3queueStatus Tff7b72= Te6edf3protoTb4b4b4.Te6edf3queueStatus
Tff7b72val Te6edf3config Tff7b72= Te6edf3protoTb4b4b4.Te6edf3config
Tff7b72val Te6edf3moduleConfig Tff7b72= Te6edf3protoTb4b4b4.Te6edf3moduleConfig
Tff7b72val Te6edf3channel Tff7b72= Te6edf3protoTb4b4b4.Te6edf3channel
Tff7b72val Te6edf3clientNotification Tff7b72= Te6edf3protoTb4b4b4.Te6edf3clientNotification
Tff7b72val Te6edf3deviceUIConfig Tff7b72= Te6edf3protoTb4b4b4.Te6edf3deviceuiConfig
Tff7b72val Te6edf3fileInfo Tff7b72= Te6edf3protoTb4b4b4.Te6edf3fileInfo
Tff7b72val Te6edf3xmodemPacket Tff7b72= Te6edf3protoTb4b4b4.Te6edf3xmodemPacket
Tff7b72when Tb4b4b4{
Te6edf3myInfo Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configFlowManagerTb4b4b4.Te6edf3handleMyInfoTb4b4b4(Te6edf3myInfoTb4b4b4)
T8b949e// deviceuiConfig arrives immediately after my_info (STATE_SEND_UIDATA). It carries
T8b949e// the device's display, theme, node-filter, and other UI preferences.
Te6edf3deviceUIConfig Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configHandlerTb4b4b4.Te6edf3handleDeviceUIConfigTb4b4b4(Te6edf3deviceUIConfigTb4b4b4)
Te6edf3metadata Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configFlowManagerTb4b4b4.Te6edf3handleLocalMetadataTb4b4b4(Te6edf3metadataTb4b4b4)
Te6edf3nodeInfo Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configFlowManagerTb4b4b4.Te6edf3handleNodeInfoTb4b4b4(Te6edf3nodeInfoTb4b4b4)
Te6edf3serviceRepositoryTb4b4b4.Te6edf3setConnectionProgressTb4b4b4(Ta5d6ff"Ta5d6ffNodes (Tffd700${Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configFlowManagerTb4b4b4.Te6edf3newNodeCountTffd700}Ta5d6ff)Ta5d6ff"Tb4b4b4)
Tb4b4b4}
Te6edf3configCompleteId Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configFlowManagerTb4b4b4.Te6edf3handleConfigCompleteTb4b4b4(Te6edf3configCompleteIdTb4b4b4)
Te6edf3mqttProxyMessage Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3mqttManagerTb4b4b4.Te6edf3handleMqttProxyMessageTb4b4b4(Te6edf3mqttProxyMessageTb4b4b4)
Te6edf3queueStatus Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3packetHandlerTb4b4b4.Te6edf3handleQueueStatusTb4b4b4(Te6edf3queueStatusTb4b4b4)
Te6edf3config Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configHandlerTb4b4b4.Te6edf3handleDeviceConfigTb4b4b4(Te6edf3configTb4b4b4)
Te6edf3moduleConfig Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configHandlerTb4b4b4.Te6edf3handleModuleConfigTb4b4b4(Te6edf3moduleConfigTb4b4b4)
Te6edf3channel Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configHandlerTb4b4b4.Te6edf3handleChannelTb4b4b4(Te6edf3channelTb4b4b4)
Te6edf3fileInfo Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configFlowManagerTb4b4b4.Te6edf3handleFileInfoTb4b4b4(Te6edf3fileInfoTb4b4b4)
Te6edf3xmodemPacket Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3xmodemManagerTb4b4b4.Te6edf3handleIncomingXModemTb4b4b4(Te6edf3xmodemPacketTb4b4b4)
Te6edf3clientNotification Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Te6edf3handleClientNotificationTb4b4b4(Te6edf3clientNotificationTb4b4b4)
T8b949e// Firmware rebooted without a transport-level disconnect (common on serial/TCP).
T8b949e// Re-handshake immediately rather than waiting for the 30s stall guard.
Te6edf3protoTb4b4b4.Te6edf3rebooted Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3LoggerTb4b4b4.Te6edf3w Tb4b4b4{ Ta5d6ff"Ta5d6ffFirmware rebooted (rebooted=Tffd700${Te6edf3protoTb4b4b4.Te6edf3rebootedTffd700}Ta5d6ff), re-initiating handshakeTa5d6ff" Tb4b4b4}
Te6edf3routerTb4b4b4.Te6edf3valueTb4b4b4.Te6edf3configFlowManagerTb4b4b4.Te6edf3triggerWantConfigTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Tff7b72private Tff7b72fun Td2a8ffhandleClientNotificationTb4b4b4(Te6edf3cnTb4b4b4: Te6edf3ClientNotificationTb4b4b4) Tb4b4b4{
Te6edf3serviceRepositoryTb4b4b4.Te6edf3setClientNotificationTb4b4b4(Te6edf3cnTb4b4b4)
Te6edf3scopeTb4b4b4.Te6edf3handledLaunch Tb4b4b4{
Tff7b72val Te6edf3inform Tff7b72= Te6edf3cnTb4b4b4.Te6edf3key_verification_number_inform
Tff7b72val Te6edf3request Tff7b72= Te6edf3cnTb4b4b4.Te6edf3key_verification_number_request
Tff7b72val Te6edf3verificationFinal Tff7b72= Te6edf3cnTb4b4b4.Te6edf3key_verification_final
Tff7b72val Tb4b4b4(Te6edf3titleTb4b4b4, Te6edf3typeTb4b4b4) Tff7b72=
Tff7b72when Tb4b4b4{
Te6edf3inform Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3LoggerTb4b4b4.Te6edf3i Tb4b4b4{ Ta5d6ff"Ta5d6ffKey verification inform from Tffd700${Te6edf3informTb4b4b4.Te6edf3remote_longnameTffd700}Ta5d6ff" Tb4b4b4}
Te6edf3PairTb4b4b4(Te6edf3getStringSuspendTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3key_verification_titleTb4b4b4)Tb4b4b4, Te6edf3NotificationTb4b4b4.Te6edf3TypeTb4b4b4.Te6edf3InfoTb4b4b4)
Tb4b4b4}
Te6edf3request Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3LoggerTb4b4b4.Te6edf3i Tb4b4b4{ Ta5d6ff"Ta5d6ffKey verification request from Tffd700${Te6edf3requestTb4b4b4.Te6edf3remote_longnameTffd700}Ta5d6ff" Tb4b4b4}
Te6edf3PairTb4b4b4(Te6edf3getStringSuspendTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3key_verification_request_titleTb4b4b4)Tb4b4b4, Te6edf3NotificationTb4b4b4.Te6edf3TypeTb4b4b4.Te6edf3InfoTb4b4b4)
Tb4b4b4}
Te6edf3verificationFinal Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3LoggerTb4b4b4.Te6edf3i Tb4b4b4{ Ta5d6ff"Ta5d6ffKey verification final from Tffd700${Te6edf3verificationFinalTb4b4b4.Te6edf3remote_longnameTffd700}Ta5d6ff" Tb4b4b4}
Te6edf3PairTb4b4b4(Te6edf3getStringSuspendTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3key_verification_final_titleTb4b4b4)Tb4b4b4, Te6edf3NotificationTb4b4b4.Te6edf3TypeTb4b4b4.Te6edf3InfoTb4b4b4)
Tb4b4b4}
Te6edf3cnTb4b4b4.Te6edf3duplicated_public_key Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3LoggerTb4b4b4.Te6edf3w Tb4b4b4{ Ta5d6ff"Ta5d6ffDuplicated public key notification receivedTa5d6ff" Tb4b4b4}
Te6edf3PairTb4b4b4(Te6edf3getStringSuspendTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3duplicated_public_key_titleTb4b4b4)Tb4b4b4, Te6edf3NotificationTb4b4b4.Te6edf3TypeTb4b4b4.Te6edf3WarningTb4b4b4)
Tb4b4b4}
Te6edf3cnTb4b4b4.Te6edf3low_entropy_key Tff7b72!Tff7b72= Tff7b72null Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3LoggerTb4b4b4.Te6edf3w Tb4b4b4{ Ta5d6ff"Ta5d6ffLow entropy key notification receivedTa5d6ff" Tb4b4b4}
Te6edf3PairTb4b4b4(Te6edf3getStringSuspendTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3low_entropy_key_titleTb4b4b4)Tb4b4b4, Te6edf3NotificationTb4b4b4.Te6edf3TypeTb4b4b4.Te6edf3WarningTb4b4b4)
Tb4b4b4}
Tff7b72else Tff7b72-Tff7b72> Te6edf3PairTb4b4b4(Te6edf3getStringSuspendTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3client_notificationTb4b4b4)Tb4b4b4, Te6edf3NotificationTb4b4b4.Te6edf3TypeTb4b4b4.Te6edf3InfoTb4b4b4)
Tb4b4b4}
Te6edf3notificationManagerTb4b4b4.Te6edf3dispatchTb4b4b4(
Te6edf3NotificationTb4b4b4(Te6edf3title Tff7b72= Te6edf3titleTb4b4b4, Te6edf3type Tff7b72= Te6edf3typeTb4b4b4, Te6edf3message Tff7b72= Te6edf3cnTb4b4b4.Te6edf3messageTb4b4b4, Te6edf3category Tff7b72= Te6edf3NotificationTb4b4b4.Te6edf3CategoryTb4b4b4.Te6edf3AlertTb4b4b4)Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.06s